package com.example.visitorpattern.entity;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ash
 * @description
 * @create 2023/2/25  15:57:30
 * @className ObjectStructure
 * @verson 1.0.0
 */
public class ObjectStructure {

    private static List<Element> elements = new ArrayList<>();

    public static void add(Element element){
        elements.add(element);
    }

    public static void remove(Element element){
        elements.remove(element);
    }

    public static void accept(Visitor visitor){
        elements.forEach(item ->{
            item.accept(visitor);
        });
    }

}
